Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Add recordings/compositions endpoint #27

Merged
merged 2 commits into from
Jul 25, 2017

Conversation

vrde
Copy link

@vrde vrde commented May 7, 2017

Add recordings/compositions endpoint to:

  • Create new connections between recordings and compositions using the isrc and iswc codes.
  • Retrieve recordings connected to a composition.
  • Retrieve compositions connected to a recording.

@vrde vrde requested a review from TimDaub May 7, 2017 22:01
@@ -39,6 +39,8 @@ def post(self):
location='json')
parser.add_argument('publishers', type=list, required=True,
location='json')
parser.add_argument('iswc', type=str, required=True,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make required=False. However, then matching recordings and compositions won't work for this implementation.

@vrde and I talked.



def unpack(doc):
return doc['block']['transactions']['asset']['data']
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For prosperity: One must be able to do this in a MDB query directly 🤔

omi_api/utils.py Outdated
@@ -19,5 +19,6 @@ def get_bigchaindb_api_url():
def queryparams_to_dict(queryparams):
queryparams = dict(queryparams)
for k, v in queryparams.items():
queryparams[k] = v[0]
if v:
Copy link

@TimDaub TimDaub May 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh thanks! I remember thinking about this during implementation. Then I forgot.

bdb = BigchainDB(get_bigchaindb_api_url())

recordings_compositions_views = Blueprint('recordings_compositions_views',

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm line? @vrde I can do it; or was it intentional?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh remove it.

return 'Composition and Recording were successfully connected.', 200


recordings_compositions_api.add_resource(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need an /compositions/recordings endpoint. I imagine that is not a lot of work (same functionality can be reused).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a lot of work, it's actually just one line to implement this. I didn't do it yet because I didn't want to diverge from the specs too much.


tx = bdb.transactions.prepare(
operation='CREATE',
signers=config.PUBLIC_KEY,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When #26 is merged, we should adjust this.

signers=config.PUBLIC_KEY,
asset={'data': link})

signed_tx = bdb.transactions.fulfill(tx, private_keys=config.PRIVATE_KEY)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When #26 is merged, we should adjust this.

Copy link

@TimDaub TimDaub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add documentation in Readme.md.

Other than that: Great work!

@TimDaub TimDaub force-pushed the add-recording-composition-endpoint branch from 184423f to 54ec470 Compare July 25, 2017 08:08
@TimDaub TimDaub merged commit a9f9e65 into master Jul 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants